import request from '@/utils/request'
/*
  params 会自动进行url拼接，其它类似name、search这些则不会自动拼接
*/

// 用户增删改查
export function listOrganization(params) {
  return request({
    url: '/organization/',
    method: 'get',
    params
  })
}

export function viewOrganization(id) {
  return request({
    url: '/organization/' + id + '/',
    method: 'get'
  })
}

export function addOrganization(data) {
  return request({
    url: '/organization/',
    method: 'post',
    data
  })
}

export function editOrganization(id, data) {
  return request({
    url: '/organization/' + id + '/',
    method: 'put',
    data
  })
}

export function delOrganization(id) {
  return request({
    url: '/organization/' + id,
    method: 'delete'
  })
}

// 菜单树
export function treeOrganization() {
  return request({
    url: '/tree/organization/',
    method: 'get'
  })
}

// 检查权限名是否存在
export function checkOrganizationName(params) {
  return request({
    url: '/check/organization/name/',
    method: 'get',
    params
  })
}

// 检查权限名是否存在
export function checkOrganizationPid(params) {
  return request({
    url: '/check/organization/pid/',
    method: 'get',
    params
  })
}
